package data

import "time"

type CustomerData struct {
	data *Data
}

// New 方法
func NewCustomerData(data *Data) *CustomerData {
	return &CustomerData{data: data}
}

// 设置验证码的方法
func (c *CustomerData) SetVerifyCode(telephone, code string, ex time.Duration) error {
	// 1. 设置验证码
	status := c.data.Rdb.Set(telephone, code, ex)
	if _, err := status.Result(); err != nil {
		return err
	}
	return nil
}
